#include "StdAfx.h"
#include "NetClient.h"
#include "BaseProtocol.h"

CNetClient::CNetClient(void)
{
	m_socket.SetNetClient(this);
	m_nOrigin = Origin_Unknow;
}


CNetClient::~CNetClient(void)
{
}

BOOL CNetClient::SendMsg(Msg *pMsg)
{
	return m_socket.SendMsg(pMsg);
}

BOOL CNetClient::Connect(const char *szServerAddr, int nServerPort, int nOrigin)
{
	if(!m_socket.Connect(szServerAddr, nServerPort))
	{
		return FALSE;
	}

	m_nOrigin = nOrigin;
	ClientConnectMsg connectMsg;
	connectMsg.m_nOrigin = m_nOrigin;
	SendMsg(&connectMsg);
	return TRUE;
}